package co.yixiang.mall.biz.commission.interceptor;

import co.yixiang.mall.biz.commission.excetion.CommissionExcetion;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
/** 配置全局异常拦截器 */
@ControllerAdvice
public class CommissionExceptionHander {

    @ExceptionHandler(CommissionExcetion.class)
    private ModelAndView commissionExcetion(CommissionExcetion commission){
        /** ModelAndView只是暂时的等定好返回的类型在去做修改 */
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("service charge");
        modelAndView.addObject("error",commission.getMessage());
        return modelAndView;
    }

 /*   @ExceptionHandler(OrderExection.class)
    private ModelAndView orderExection(OrderExection e){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("orderType");
        modelAndView.addObject("error",e.getMessage());
        return modelAndView;
    }*/

}
